import request from './index'

export const userListAPI = params => request({
  method: 'GET',
  url: '/users',
  params
})
export const usersStateAPI = (uld, type) => request({
  method: 'PUT',
  url: `users/${uld}/state/${type}`
})

export const addUserAPI = data => request({
  method: 'POST',
  url: 'users',
  data
})

export const editUserAPI = id => request({
  method: 'GET',
  url: `users/${id}`
})

export const editUserInfoAPI = (id, data) => request({
  method: 'put',
  url: `users/${id}`,
  data
})

export const UserRemoveAPI = id => request({
  method: 'DELETE',
  url: `users/${id}`
})
export const rolesAPI = _ => request({
  method: 'GET',
  url: 'roles'
})
export const saveRolesAPI = (id, rid) => request({
  method: 'PUT',
  url: `users/${id}/role`,
  rid
})
